/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.mysql;

import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 * MysqlTabelasTableModel
 *
 * @author Icaro
 */
public class MysqlTabelasTableModel extends AbstractTableModel {

    private List<String> listVersao;
    private boolean ordenarPorNome = true;

    public MysqlTabelasTableModel(List<String> listVersao) {
        this.listVersao = listVersao;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        String ver = listVersao.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return ver;
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listVersao.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    public String getValoresString(int rowIndex) {
        return listVersao.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }

    public void removeRow(int row) {
        listVersao.remove(row);
        fireTableRowsDeleted(row, row);
    }

}
